#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e4 + 5;

int n, m;
int head[N], c[N];
int ver[N << 1], W[N << 1], Next[N << 1], tot;
void add(int u, int v, int w) {
  ++tot;
  ver[tot] = v;
  W[tot] = w;
  Next[tot] = head[u];
  head[u] = tot;
}

int f[N][18];
ll d[N][18];
void dfs_st(int u, int fu, ll w) {
  f[u][0] = fu;
  d[u][0] = w;
  for (int i = head[u]; i; i = Next[i]) {
    int v = ver[i];
    if (v == fu) continue;
    dfs_st(v, u, W[i]);
  }
}
void init_st() {
  dfs_st(1, 0, 0);
  rep(j, 1, 16) rep(i, 1, n) {
    f[i][j] = f[f[i][j - 1]][j - 1];
    d[i][j] = d[i][j - 1] + d[f[i][j - 1]][j - 1];
  }
}
vector<ll> army[N];
void init_army(ll t) {
  rep(i, 1, n) army[i].clear();
  rep(i, 1, m) {
    int u = c[i];
    ll x = t;
    per(j, 16, 0) {
      if (f[u][j] > 1 && d[u][j] <= x) {
        x -= d[u][j];
        u = f[u][j];
      }
    }
    army[u].push_back(x);
  }
  rep(i, 1, n) sort(army[i].begin(), army[i].end(), greater<ll>());
}
int ok[N];
void dfs(int u, int fu) {
  ok[u] = 0;
  int chcnt = 0, okch = 1;
  for (int i = head[u]; i; i = Next[i]) {
    int v = ver[i];
    if (v == fu) continue;
    dfs(v, u);
    chcnt++;
    if (!ok[v]) okch = 0;
  }
  if (chcnt && okch)
    ok[u] = 1;
  else if (army[u].size()) {
    if (army[u].back() <= d[u][0] * 2) {
      /* if the army could not go further, it would stay in this city,
       or go further first, as the army could go back anyway.
       */
      ok[u] = 1;
      army[u].pop_back();
    }
  }
}
bool check(ll t) {
  init_army(t);
  ok[1] = 0;
  vector<ll>& a1 = army[1];
  vector<ll> a2;
  for (int i = head[1]; i; i = Next[i]) {
    int v = ver[i];
    dfs(v, 1);
    if (!ok[v]) a2.push_back(W[i]);
    for (ll x : army[v]) {
      if (x > W[i]) a1.push_back(x - W[i]);
    }
  }
  sort(a1.begin(), a1.end());
  sort(a2.begin(), a2.end());
  int j = 0;
  for (ll x : a1) {
    if (j >= a2.size()) break;
    if (x >= a2[j]) j++;
  }
  return j >= a2.size();
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 2, n) {
    int u, v, w;
    cin >> u >> v >> w;
    add(u, v, w), add(v, u, w);
  }
  cin >> m;
  rep(i, 1, m) cin >> c[i];
  init_st();

  ll l = 1, r = 5e13;
  while (l <= r) {
    ll mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  if (l > 5e13)
    cout << -1;
  else
    cout << l;
  return 0;
}